import {Net} from "foundation"
import {waitingRegistry} from "MVx/src/thirdservice/ts";
import {AppId} from "../config";


export  function RegisterAutoLogin(net:Net) {
  waitingRegistry.set(net.getBaseUrl(), []);
  net.set401Delegate(async _ =>{
    let url = encodeURIComponent(`${window.location.origin}/#/package/login/wechat`);
    window.location.href = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${AppId}&redirect_uri=${url}&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect`
  })
}
